/**
 * Created by Administrator on 2016/4/21.
 */
angular.module('gwysl.service',[])
  .service('gwyslService',['appItfAopService','$ionicLoading','$timeout','ddcxService',function(appItfAopService,$ionicLoading,$timeout,ddcxService){

    var params={
      "IdCard":{},
      "GuoZhengtong":{},
      "step1":"",
      "step2":"",
      "step3":"",
      "step4":"",
      "SixAddrList":{},
      "sixAddress":{},
      "SevenAddrList":{},
      "sevAddr":{},
      "speeds":[{"speed":"10M"},{"speed":"20M"},{"speed":"50M"},{"speed":"100M"}],
      "selspeed":"",
      "additional":"no",
      "projCheck":"" //资源预判参数
    }

    return {
      getParams:function() {
        return params;
      },
      ReadIdCard :function(param){
        $ionicLoading.show({
        });
        bluetooth.sr_lydk(param,function(success){
            $ionicLoading.hide();
            $timeout(function(){
              params.IdCard=angular.fromJson(success);
              //alert(params.IdCard.address);
            },1000);
            params.step1=1;
          },function(error){
            $ionicLoading.hide();
            var alertPopup=$ionicPopup.alert({
              title:'读取失败',
              template:angular.toJson(error),
              okText: '确定', // String (默认: 'OK')。OK按钮的文字。
              okType: 'item-customer-bg-darkred', // String (默认: 'button-positive')。OK按钮的类型。
            });
            params.step1=0;
          }
        )
        return params.IdCard;
      },
      //国政通查询
      AuthenCustInfo:function(param){
        return appItfAopService.do_authenCustInfo_req(param);
      },
      //客户信息认证
      Authenticate:function(param){
        return appItfAopService.do_authenticate_req(param);
      },
      //查询用户是否办过套餐
      doGwRefresh:function(params)
      {
        return appItfAopService.do_queryFixNetOrderList_req(params)
      },
      //查询6级7级地址
      queryAddress:function(param) {
        return appItfAopService.do_queryAddrss_req(param);
      },
      //资源预判
      projCheck:function(param){
        return appItfAopService.do_projCheck_req(param);
      },
      //固网开户预提交
      NetWorkPreSubmit:function(param){
      return appItfAopService.do_NetWorkPreSubmit_req(param);
      },
      //插入日志
      insertLog:function(param)
      {
        return appItfAopService.do_insertLog_req(param);
      }
    }
  }]);
